﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;

namespace Chat.API
{
    /// <summary>
    /// 聊天集线器，用于客户端进行远程调用
    /// </summary>
    public class ChatHub : Hub
    {
        public void Hello()
        {
            Clients.All.hello();
        }
        /// <summary>
        /// 广播消息
        /// </summary>
        /// <param name="name"></param>
        /// <param name="message"></param>
        public void Send(string name, string message)
        {
            //Call the broadcastMessage method to update clients.
            //broadcastMessage是一个动态属性，是client端的方法
            Clients.All.broadcastMessage(name, message);
        }
    }
}